class Player {
    private String name;
    private int age;
    private static final AtomicInteger count=new AtomicInteger(0);

    private Player(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public static Player create(String name, int age) throws Exception {
        if (count.get() == 11) {
            throw new Exception("已达到创建数量上限，无法创建新对象");
        }
        count.incrementAndGet();
        return new Player(name, age);
    }
}